package com.uidp.hibernatelayer;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.CascadeType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.acsior.dac.impl.hibernate.vo.HibernateVO;

/**
 * Attributes generated by hbm2java
 */
@Entity
@Table(name = "attributes", catalog = "uidpdb")
public class AttributesVO extends HibernateVO {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -666668067754573212L;
	private Integer id;
	private AttributeTypeVO attributeType;
	private ModulElementsVO modulElements;
	private String uniqname;
	private Boolean isRequired;
	private String attributeName;
	private Integer ordering;
	private List<GroupsAttributeVO> groupsAttributes;
	private List<AttributeDataVO> attributeDatas;

	// Constructors

	/** default constructor */
	public AttributesVO() {
		this.groupsAttributes = new ArrayList<GroupsAttributeVO>();
		this.attributeDatas = new ArrayList<AttributeDataVO>();
	}

	/** minimal constructor */
	public AttributesVO(AttributeTypeVO attributeType,
			ModulElementsVO modulElements, Boolean isRequired) {
		this.attributeType = attributeType;
		this.modulElements = modulElements;
		this.isRequired = isRequired;

	}

	/** full constructor */
	public AttributesVO(AttributeTypeVO attributeType,
			ModulElementsVO modulElements, String uniqname, Integer ordering,
			String attributeName, Boolean isRequired,
			List<GroupsAttributeVO> groupsAttributes,
			List<AttributeDataVO> attributeDatas) {
		this.attributeType = attributeType;
		this.modulElements = modulElements;
		this.uniqname = uniqname;
		this.ordering = ordering;
		this.attributeName = attributeName;
		this.isRequired = isRequired;
		this.groupsAttributes = groupsAttributes;
		this.attributeDatas = attributeDatas;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "attribute_type_id", nullable = false)
	public AttributeTypeVO getAttributeType() {
		return this.attributeType;
	}

	public void setAttributeType(AttributeTypeVO attributeType) {
		this.attributeType = attributeType;
	}

	@Column(name = "ordering", nullable = false)
	public Integer getOrdering() {
		return this.ordering;
	}

	public void setOrdering(Integer ordering) {
		this.ordering = ordering;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "modul_elements_id", nullable = false)
	public ModulElementsVO getModulElements() {
		return this.modulElements;
	}

	public void setModulElements(ModulElementsVO modulElements) {
		this.modulElements = modulElements;
	}

	@Column(name = "uniqname", length = 30)
	public String getUniqname() {
		return this.uniqname;
	}

	public void setUniqname(String uniqname) {
		this.uniqname = uniqname;
	}

	@Column(name = "attribute_name", length = 30)
	public String getAttributeName() {
		return attributeName;
	}

	public void setAttributeName(String attributeName) {
		this.attributeName = attributeName;
	}

	@Column(name = "is_required", nullable = false)
	public Boolean getIsRequired() {
		return this.isRequired;
	}

	public void setIsRequired(Boolean isRequired) {
		this.isRequired = isRequired;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "attributes")
	public List<GroupsAttributeVO> getGroupsAttributes() {
		return this.groupsAttributes;
	}

	public void setGroupsAttributes(List<GroupsAttributeVO> groupsAttributes) {
		this.groupsAttributes = groupsAttributes;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "attributes")
	public List<AttributeDataVO> getAttributeDatas() {
		return this.attributeDatas;
	}

	public void setAttributeDatas(List<AttributeDataVO> attributeDatas) {
		this.attributeDatas = attributeDatas;
	}

	@Override
	public void setId(Object id) {
		// TODO Auto-generated method stub

	}

}
